package org.hot100_3;

public class leetcode153 {
    public int findMin(int[] nums) {

        int left = 0;
        int right = nums.length-1;

        int min = nums[0];

        while (left<=right){

            int mid =(left+right)>>>1;

            //左半部分有序
            if (nums[left]<=nums[mid]){
                min=Math.min(min,nums[left]);
                left=mid+1;
            }else {
                min=Math.min(min,nums[mid]);
                right=mid-1;
            }
        }


        return min;
    }
}
